﻿(function () {
	var el,
	dt,
	trs = $(".result-tb tr"),
	yMore = $("#yMore"),
	ySel = $("#ySel");
	
	dt = function () {
		var d = new Date(),
		wd = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
		dt = d.getFullYear() + "年" + (d.getMonth() + 1) + "月" + d.getDate() + "日 " + wd[d.getDay()];
		return {"y": d.getFullYear(), "m": d.getMonth() + 1, "d": d.getDate(), "w": wd[d.getDay()]};
	}();
	$(".dt").html("今天是 " + dt.y + "年 " + dt.m + "月 " + dt.d + "日 " + dt.w);

	trs.click(function (event) {
		el = event.currentTarget;
		if (el.className === "tr0") {
			el.className = "";
		} else {
			trs = $(".result-tb tr").attr("class","");
			el.className = "tr0";
			window.open("person.htm");
		}
	});
	
	yMore.click(function() {
		ySel.css({
			"height": "80px",
			"overflow-y": "scroll"
		});	
	});
	ySel.click(function(evt) {
		$el = $(evt.target);
		ySel.css({
			"height": "22px",
			"overflow-y": "hidden"
		});	
		if ($el[0].tagName == "A") {
			$(this).find("a").attr("class","a0");
			$el.attr("class","a1");
			ySel.scrollTop(0);
			ySel.scrollTop($el.position().top);
		}
	})

}());
